package com.zhipu.resetbalance.ui.home.system.bh;

import androidx.lifecycle.ViewModel;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupAnimation;
import com.zhipu.resetbalance.listener.ChooseClickCallback1;
import com.zhipu.resetbalance.mobile.event.NumberedEntity;
import com.zhipu.resetbalance.pop.AddNumberPopup;

public class NumberManagementViewModel extends ViewModel {



    public void NumberList(){

    }



    public void AddPersonnel(){
        AddNumberPopup mAddNumberPopup = new AddNumberPopup(ActivityUtils.getTopActivity());
        mAddNumberPopup.setChooseClickCallback(new ChooseClickCallback1() {
            @Override
            public void onChooseClickCallback(String mData) {
                NumberedEntity mNumberedEntity = new NumberedEntity();
                //
                mNumberedEntity.NumberedName = mData;
                //
                mNumberedEntity.creationTime = TimeUtils.getNowMills();
                //
                mNumberedEntity.save();
            }
        });
        new XPopup
                .Builder(ActivityUtils.getTopActivity())
                .popupAnimation(PopupAnimation.ScaleAlphaFromCenter)
                .asCustom(mAddNumberPopup)
                .show();
    }


    public void AddPersonnel(NumberedEntity mNumberedEntity){
        AddNumberPopup mAddNumberPopup = new AddNumberPopup(ActivityUtils.getTopActivity());
        mAddNumberPopup.setChooseClickCallback(new ChooseClickCallback1() {
            @Override
            public void onChooseClickCallback(String mData) {
                NumberedEntity mNumberedEntity = new NumberedEntity();
                //
                mNumberedEntity.NumberedName = mData;
                //
                mNumberedEntity.creationTime = TimeUtils.getNowMills();
                //
                mNumberedEntity.save();
            }
        });
        new XPopup
                .Builder(ActivityUtils.getTopActivity())
                .popupAnimation(PopupAnimation.ScaleAlphaFromCenter)
                .asCustom(mAddNumberPopup)
                .show();
    }



    public void shutDown(){
        //
        ActivityUtils.finishActivity(NumberManagementActivity.class);
    }
}

